import { Component, OnInit, Input } from '@angular/core';

import { Platform } from '@ionic/angular';

import { AppGlobalService } from 'src/app/shared/service/app-global.service';

@Component({
  selector: 'app-copy-to-paste-btn',
  templateUrl: './copy-to-paste-btn.component.html',
  styleUrls: ['./copy-to-paste-btn.component.scss'],
})
export class CopyToPasteBtnComponent implements OnInit {
  @Input() tagData: any;
  appTypeCustom: any;
  cssStr = {}; // css样式

  constructor(
    private appGlobalService: AppGlobalService,
    private platform: Platform
    ) { }

  ngOnInit() {
    const bodyStyles = window.getComputedStyle(document.body);
    this.appTypeCustom = bodyStyles.getPropertyValue('--appTypeCustom').trim().replace('"', '').replace('"', '');
    console.log(this.tagData);
    if (this.tagData.data.cssStyle) {
      const cssStyles = this.tagData.data.cssStyle.split(";");
      cssStyles.map( v => {
        const cssStrs = v.split(":");
        this.cssStr[cssStrs[0]] = cssStrs[1];
      });
    }
  }

  copyUrl(str) {
    this.appGlobalService.copyString(str);
  }

}
